package com.huiquan.vocab.dao;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.framework.base.EnhancedBaseDao;
import com.huiquan.vocab.domain.VocabWildcard;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class VocabWildcardDao extends EnhancedBaseDao<VocabWildcard> {

	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "VOCAB_WILDCARD.";

	public VocabWildcardDao() {
		super(space);
	}

	public VocabWildcard retrieveObjectByNameAndProperty(String name, String property) {
		Map<String, Object> param = new HashMap<>();
		param.put("name", name);
		param.put("property", property);
		
		return (VocabWildcard)this.object(space + "RETRIEVE_OBJECT", param, sqlMapClient);
	}

	public void restore(VocabWildcard vw) {
		this.update(space + "RESTORE", vw, sqlMapClient);
	}
}
